﻿<PropertyPanels:GadgetPropertiesPanelBase x:Class="EpiDashboard.Controls.GadgetProperties.ComplexSampleMeansProperties"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:Controls="clr-namespace:EpiDashboard.Controls"
             xmlns:PropertyPanels="clr-namespace:EpiDashboard.Controls.GadgetProperties"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800" Loaded="UserControl_Loaded" Style="{DynamicResource PropertiesPanelStyle}">
    <PropertyPanels:GadgetPropertiesPanelBase.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../StyleDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </PropertyPanels:GadgetPropertiesPanelBase.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MaxWidth="400" MinWidth="300" Width=".33*" />
            <ColumnDefinition Width="30" />
            <ColumnDefinition MinWidth="275" Width=".66*"  />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0"  Background="{StaticResource PrimaryAccentColorLight}" >
            <Border BorderBrush="#015796" BorderThickness="0 0 0 1">
                <Viewbox StretchDirection="DownOnly" Stretch="Uniform" HorizontalAlignment="Left">
                    <Label x:Name="lblConfigExpandedTitle" FontWeight="Light" Foreground="White" FontSize="56" Margin="0, 0, 0, 10" xml:space="preserve">
                        <TextBlock TextWrapping="Wrap" x:Name="lblConfigExpandedTitleTxt">Complex Sample Means</TextBlock>
                    </Label>
                </Viewbox>
            </Border>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.RowSpan="2" Grid.Row="1" x:Name="panelSidebar" Background="{StaticResource PrimaryAccentColorLight}">
            <Controls:SettingsToggleButton x:Name="tbtnVariables" Title="Variables" Description="Select columns to display in the list." IsChecked="True" Checked="tbtnVariables_Checked"/>
            <!--<Controls:SettingsToggleButton x:Name="tbtnSorting" Title="Sorting and Grouping" Description="Set a sort order and create list groups." IsChecked="False" Checked="tbtnSorting_Checked"/>-->
            <Controls:SettingsToggleButton x:Name="tbtnDisplay" Title="Display" Description="Change display options." IsChecked="False" Checked="tbtnDisplay_Checked"/>
            <Controls:SettingsToggleButton x:Name="tbtnFilters" Title="Filters" Description="Set data filters for this gadget." IsChecked="False" Checked="tbtnFilters_Checked"/>
        </StackPanel>
       
        <DockPanel x:Name="panelVariables" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Visible">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelVariables" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockPanelVariablesTxt">Variables</TextBlock>
                </Label>
            </StackPanel>

            <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" DockPanel.Dock="Bottom">
                <StackPanel>
                    <Label x:Name="tblockMeansOf">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockMeansOfTxt">Means of:</TextBlock>
                    </Label>
                    <ComboBox x:Name="cbxField" Width="216" HorizontalAlignment="Left" Height="28" />
                    <Label x:Name="tblockWeightVariable">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockWeightVariableTxt">Weight:</TextBlock>
                    </Label>
                    <ComboBox x:Name="cbxFieldWeight" Width="216" HorizontalAlignment="Left" Height="28" />
                    <StackPanel Height="12" />
                    <TextBlock x:Name="tblockStrataVariable" TextWrapping="Wrap" >Stratify by:</TextBlock>
                    <ComboBox x:Name="cbxFieldStrata" Width="216" HorizontalAlignment="Left" Height="28" />

                    <StackPanel Height="12" />
                    <TextBlock x:Name="tblockCrosstabVariable" TextWrapping="Wrap" >Cross-tabulate by:</TextBlock>
                    <ComboBox x:Name="cbxFieldCrosstab" Width="216" HorizontalAlignment="Left" Height="28" />

                    <StackPanel Height="12" />

                    <TextBlock x:Name="tblockPSU" TextWrapping="Wrap" >PSU:</TextBlock>
                    <ComboBox x:Name="cbxFieldPSU" Width="216" HorizontalAlignment="Left" Height="28" />
                </StackPanel>
            </ScrollViewer>
        </DockPanel>

        <DockPanel x:Name="panelSorting" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelSorting" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockPanelSortingTxt">Sorting and Grouping</TextBlock>
                </Label>
            </StackPanel>

            <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" DockPanel.Dock="Bottom" x:Name="scrollViewerProperties">
                <StackPanel>
                    <Label x:Name="tblockGroupingSubheader" Style="{StaticResource PropertiesSubHeading}" Margin="0, 0, 0, 5">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockGroupingSubheaderTxt">Grouping</TextBlock>
                    </Label>
                    <Label x:Name="tblockGroupby">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockGroupbyTxt">Group By:</TextBlock>
                    </Label>
                    <ComboBox x:Name="cmbGroupField" Width="{Binding ElementName=lbxAvailableVariables, Path=ActualWidth}" HorizontalAlignment="Left"/>

                    <Label x:Name="tblockSubGroupBy">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockSubGroupByTxt">Sub-group By:</TextBlock>
                    </Label>
                    <ComboBox x:Name="cmbSecondaryGroupField" Width="{Binding ElementName=lbxAvailableVariables, Path=ActualWidth}" HorizontalAlignment="Left"/>

                    <Label x:Name="tblockSortingSubheader" Style="{StaticResource PropertiesSubHeading}" Margin="0, 26, 0, 5">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockSortingSubheaderTxt">Sorting</TextBlock>
                    </Label>

                    <Label x:Name="tblockSortMethod">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockSortMethodTxt">Sort Method:</TextBlock>
                    </Label>
                    <ComboBox x:Name="cmbSortMethod" Width="{Binding ElementName=lbxAvailableVariables, Path=ActualWidth}" HorizontalAlignment="Left" SelectedIndex="0" Margin="0, 0, 0, 8">
                        <ComboBoxItem>Ascending</ComboBoxItem>
                        <ComboBoxItem>Descending</ComboBoxItem>
                    </ComboBox>

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width=".5*" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width=".5*" />
                        </Grid.ColumnDefinitions>
                        <StackPanel Grid.Column="0">
                            <Label x:Name="tblockAvailableVariables">
                                <TextBlock TextWrapping="Wrap" x:Name="tblockAvailableVariablesTxt">Available Variables:</TextBlock>
                            </Label>
                            <ListBox x:Name="lbxAvailableVariables" Height="370" MouseDoubleClick="lbxAvailableVariables_MouseDoubleClick" />
                        </StackPanel>

                        <StackPanel Grid.Column="2">
                            <Label x:Name="tblockSortOrder">
                                <TextBlock TextWrapping="Wrap" x:Name="tblockSortOrderTxt">Sort Order:</TextBlock>
                            </Label>
                            <ListBox x:Name="lbxSortOrder" Height="370" MouseDoubleClick="lbxSortOrder_MouseDoubleClick" />
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </ScrollViewer>
        </DockPanel>

        <DockPanel x:Name="panelDisplay" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelDisplay" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockPanelDisplayTxt">Display</TextBlock>
                </Label>
            </StackPanel>

            <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" DockPanel.Dock="Bottom" x:Name="scrollViewerDisplay">
                <StackPanel>
                    <Label x:Name="tblockTitleNDescSubheader" Style="{StaticResource PropertiesSubHeading}" Margin="0,0, 0, 5">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockTitleNDescSubheaderTxt">Title and Description</TextBlock>
                    </Label>
                    <StackPanel Orientation="Vertical">
                        <StackPanel>
                            <Label x:Name="tblockTitle" VerticalAlignment="Bottom" HorizontalAlignment="Left">
                                <TextBlock TextWrapping="Wrap" x:Name="tblockTitleTxt">Gadget title:</TextBlock>
                            </Label>
                            <TextBox x:Name="txtTitle" AcceptsReturn="True" TextWrapping="Wrap" Style="{StaticResource PropertiesGadgetTitle}" HorizontalAlignment="Left"></TextBox>
                        </StackPanel>
                        <StackPanel Margin="0 10 0 0">
                            <Label x:Name="tblockDesc" VerticalAlignment="Bottom" HorizontalAlignment="Left">
                                <TextBlock TextWrapping="Wrap" x:Name="tblockDescTxt">Gadget description:</TextBlock>
                            </Label>
                            <TextBox x:Name="txtDesc" Style="{StaticResource PropertiesGadgetDescription}" TextWrapping="Wrap" AcceptsReturn="True" HorizontalAlignment="Left"></TextBox>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </ScrollViewer>
        </DockPanel>

        <DockPanel  x:Name="panelFilters" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelDataFilter" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockPanelDataFilterTxt">Data Filters</TextBlock>
                </Label>
                <Label x:Name="tblockAnyFilterGadgetOnly">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockAnyFilterGadgetOnlyTxt">Note: Any filters set here are applied to this gadget only.</TextBlock>
                </Label>
            </StackPanel>
        </DockPanel>

        <Button Style="{StaticResource CloseButtonStyle}" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="8" Click="CloseButton_Click" />

        <DockPanel Grid.ColumnSpan="3" Grid.Row="2">
            <Button x:Name="btnCancel" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="8" Width="134" Height="42" Click="btnCancel_Click">
                <TextBlock TextWrapping="Wrap" x:Name="btnCancelTxt">Cancel</TextBlock>
            </Button>
            <Button x:Name="btnOK" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="8" Width="134" Height="42" Click="btnOK_Click">
                <TextBlock TextWrapping="Wrap" x:Name="btnOKTxt">OK</TextBlock>
            </Button>
        </DockPanel>
    </Grid>
</PropertyPanels:GadgetPropertiesPanelBase>
